package com.fun.fun.profile;

import com.fun.profile.SysInit;

import java.io.File;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.List;

/**
 * 常量类
 */
public class Constant {

    /*常用的常量*/
    public static final String LINE = "\r\n";

    public static final String TAB = "\t";

    public static final String EMPTY = "";

    public static final String PART = "|";

    public static final String OR = "/";

    public static final String SPACE_1 = " ";

    public static final String DEFAULT_PASSWORD = "111111";

    public static final int TEST_ERROR_CODE = -2;

    public static final String DATAINFO = "dataInfo";

    public static final String CODE = "code";

    public static final String LOGINKEY = "loginKey";

    public static final String TOKEN = "token";

    public static final String TYPE = "type";

    public static final String FILE_TYPE_LOG = ".log";

    public static final String MACHINE_ID = "89684E7D-C71E-48E0-BA4F-2315D4A08B38";

    public static final String SIZE = "size";

    public static final String NO = "no";

    /**
     * output参数化输出key
     */
    public static final String OUT_KEY = "-";

    /**
     * 格式化string是的总长度-1
     */
    public static final int STRING_FORMAT_LIMIT = 6;

    /**
     * 请求类型web
     */
    public static final int REQUEST_TYPE_WEB = 1;

    /**
     * 请求类型Android
     */
    public static final int REQUEST_TYPE_ANDROID = 2;

    /**
     * 请求类型iOS
     */
    public static final int REQUEST_TYPE_IOS = 4;

    /**
     * UTF-8字符编码格式
     */
    public static final Charset UTF_8 = Charset.forName("UTF-8");

    /**
     * gb2312编码格式
     */
    public static final Charset GB2312 = Charset.forName("gb2312");

    /**
     * Unicode编码格式
     */
    public static final Charset UNICODE = Charset.forName("Unicode");

    /**
     * utf-16字符集
     */
    public static final Charset UTF_16 = Charset.forName("UTF-16");

    /**
     * ISO-8859-1编码格式
     */
    public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");

    /**
     * GBK编码格式
     */
    public static final Charset GBK = Charset.forName("GBK");

    /**
     * 默认字符集
     */
    public static Charset DEFAULT_CHARSET = UTF_8;

    /**
     * 当前工作目录
     */
    public static final String WORK_SPACE = getWorkSpase() + OR;

    /**
     * 微信消息存储目录
     */
    public static final String WX_PATH = WORK_SPACE + "long/wx/";

    /**
     * 测试数据存储目录
     */
    public static final String LONG_Path = WORK_SPACE + "long/";

    /**
     * 日志存存储目录
     */
    public static final String LOG_Path = WORK_SPACE + "log/";

    /**
     * 需要通知的错误码集合
     */
    public static final List<Integer> ERROR_CODE_LIST = Arrays.asList(1, 10, 202, 300, 500, 600, 1404, 1405, 10404, 10415, 10500);

    /**
     * host地址黑名单
     */
    public static final List<String> BLACK_HOST = Arrays.asList("alertover", "tuling123", "fv1314", "lonelymind", "gudanxinshi", "dygang", "dytt8", "ygdy8");

    /**
     * 毫秒数
     */
    public static final long DAY = 86400000;

    /**
     * 反射方法执行用例时间间隔
     */
    public static final int EXCUTE_GAP_TIME = 10;

    /**
     * 本机ip，程序初始化会赋值
     */
    public static String LOCAL_IP = SysInit.getLocalIp();

    /**
     * 本机用户名，程序初始化会赋值
     */
    public static String COMPUTER_USER_NAME = SysInit.getComputerName();

    /**
     * POST请求
     */
    public static final String REQUEST_TYPE_POST = "POST";

    /**
     * GET请求
     */
    public static final String REQUEST_TYPE_GET = "GET";

    /**
     * 请求头，cookie
     */
    public static final String REQUEST_HEADER_COOKIE = "Cookie";

    /**
     * 获取当前工作路径
     *
     * @return 返回当前工作控件的绝对路径
     */
    private static String getWorkSpase() {
        File directory = new File(EMPTY);
        String abPath = directory.getAbsolutePath();
        return abPath;
    }

}
